package com.xiao.mall.foundation.datasource;

public class DynamicRoutingDataSourceContext {
    public static final String MASTER = "master";	//主(写)连接池
    public static final String SLAVE = "slave";		//从(读)连接池

    public static final ThreadLocal<String> holder = new ThreadLocal<String>();

    public static void useMaster() {
        holder.set(MASTER);
    }

    public static void useSlave() {
        holder.set(SLAVE);
    }

    public static String getDataSource() {
        return holder.get();
    }
}
